package com.king.pattem.proxy.dynamic;

import java.lang.reflect.Method;

import com.king.pattem.proxy.statics.DBQuery;
import com.king.pattem.proxy.statics.IDBQuery;

import javassist.util.proxy.MethodHandler;

/**
 * Javassist动态代理
 * @author taomk
 * @version 1.0
 * @since 15-1-16 下午10:02
 */
public class JavassistDbQueryHandler implements MethodHandler {

	private IDBQuery real = null;

	@Override
	public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
		if (real == null) {
			real = new DBQuery();
		}
		return real.request();
	}
}
